import request from '@/utils/request'

export function getParamsPages(params) {
  return request({
    url: '/sys/params/getPage',
    method: 'get',
    params
  })
}

export function getParamsById(id) {
  return request({
    url: '/sys/params/getById',
    method: 'get',
    params: {
      id
    }
  })
}

export function paramsAdd(data) {
  return request({
    url: '/sys/params/save',
    method: 'post',
    data
  })
}

export function paramsUpdate(data) {
  return request({
    url: '/sys/params/edit',
    method: 'post',
    data
  })
}

export function paramsDel(id) {
  return request({
    url: '/sys/params/delete',
    method: 'get',
    params: {
      id
    }
  })
}

export function paramsUpdateDisabled(ids, enable) {
  let _ids = []
  if (Array.isArray(ids)) _ids = ids
  else _ids = [ids]
  return request({
    method: 'get',
    url: '/sys/params/updateStatus',
    params: {
      ids: _ids.join(','),
      status: enable
    }
  })
}
